package com.hq.bootdemo.service.impl;

import com.hq.bootdemo.entity.RoomEntity;
import com.hq.bootdemo.mapper.RoomMapper;
import com.hq.bootdemo.service.RoomService;
import com.hq.bootdemo.util.JSONUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RoomServiceImpl implements RoomService
{
    @Resource
    RoomMapper roomMapper;
    @Override
    public List<RoomEntity> selectAll() {
        return roomMapper.selectAll();
    }

    @Override
    public boolean insertOne(String rNum, int rType) {
        if(rNum == null || rNum == "" || rType == 0)return false;
        return roomMapper.insertOne(rNum, rType) != 0;
    }

    @Override
    public String selectOne(int id) {
        return JSONUtil.getJson(roomMapper.selectOne(id));
    }
}
